package com.pyue.eam.admin.utils;

import cn.hutool.core.collection.CollStreamUtil;
import cn.hutool.core.collection.CollUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

/**
 * @author ：
 * @date ：Created in 2022/11/13 23:41
 * @description：配置自动打开浏览器
 * @modified By：
 * @version:1.0
 */
@Component    // 该注解把类实例化到spring容器中相当于配置文件
public class MyBrowserRunner implements CommandLineRunner {

    // 框架自带的日志 打印信息到控制台
    private static Logger logger = LoggerFactory.getLogger(MyBrowserRunner.class);

    // private String loginUrl="http://localhost";
    //
    // private String googleExcutePath="D:\\360\\极速\\360Chrome\\Chrome\\Application\\360chrome.exe";


    @Override
    public void run(String... args) throws Exception {

        // String cmd = googleExcutePath +" "+ loginUrl;
        // Runtime run = Runtime.getRuntime();
        try {
            // Runtime.getRuntime().exec("open http://www.example.com/");
            logger.debug("启动浏览器打开项目成功");
        } catch (Exception e) {
            e.printStackTrace();
            logger.error(e.getMessage());
        }
    }
}
